package com.mengniu.commerce.sync.api;

import com.mengniu.commerce.common.core.constant.SecurityConstants;
import com.mengniu.commerce.common.core.constant.ServiceNameConstants;
import com.mengniu.commerce.sync.api.base.MnResult;
import com.mengniu.commerce.sync.api.domain.PointsIncreaseModel;
import com.mengniu.commerce.sync.api.domain.PointsReduceModel;
import com.mengniu.commerce.sync.api.factory.RemotePointFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;


/**
 * 数据同步 --商品服务
 *
 * @author yz_sm
 */
@FeignClient(contextId = "RemotePointService", value = ServiceNameConstants.DATA_SYNC_SERVICE, fallbackFactory = RemotePointFallbackFactory.class)
public interface RemotePointService
{
    /**
     * 商品创建
     *
     * @param  pointsIncreaseModel 商品创建集合
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/point/increase")
     MnResult increasePoint(@RequestBody PointsIncreaseModel pointsIncreaseModel, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 扣减积分
     * @param pointsReduceModel
     * @param source
     * @return
     */
    @PostMapping(value = "/point/decreasePoint")
     MnResult decreasePoint(@RequestBody PointsReduceModel pointsReduceModel, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
